package com.migo.api;

import com.migo.annotation.IgnoreAuth;
import com.migo.oss.OSSFactory;
import com.migo.service.FeedbackService;
import com.migo.service.SysOssService;
import com.migo.thread.FeedbackThread;
import com.migo.utils.R;
import com.migo.utils.ThreadPoolUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutorService;

/**
 * Created by Wes on 2019/1/15.
 */
@RestController
@RequestMapping("/api")
public class ApiFeedbackController extends ApiBaseController{

    @Autowired
    OSSFactory ossFactory;

    @Autowired
    private SysOssService sysOssService;


    @Autowired
    private FeedbackService feedbackService;

    /**
     * 创建意见反馈
     */
    @IgnoreAuth
    @RequestMapping("/createFeedback")
    public R createFeedback(@RequestBody String params) throws Exception {
        ExecutorService threadPool = ThreadPoolUtils.getThreadPool();
        threadPool.execute(new FeedbackThread(params, feedbackService, ossFactory));
        return R.ok();
    }





}
